<!--
<div class="row">
	<div class="col-md-6">
		<ul class="nav nav-tabs nav-menu">
		  <li id="home"><a href="/home"><span style="font-size: medium;"> 🎥 </span> 聚合首页</a></li>
		  <li id="live"><a href="/live"><span style="font-size: medium;"> 📺︎ </span> 电视直播</a></li>
		  <li id="acg" ><a href="/acg" ><span style="font-size: medium;"> 🥷 </span> 动漫番剧</a></li>
		</ul>
	</div>
	<div class="col-md-6">
		<ul class="nav nav-tabs nav-menu nav-right">
		  <li><a href=""><span style="font-size: medium;"> 📰 </span></a></li>
		</ul>
	</div>
</div>
-->

<!-- custom css -->
<link rel="stylesheet" type="text/css" href="/css/index.css">

<div class="nav-menu">

<nav class="navbar" role="navigation">
  <div class="container-fluid">
    <!-- 导航头部 -->
    <div class="navbar-header">
      <!-- 移动设备上的导航切换按钮 -->
      <!--
      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse-example">
        <span class="sr-only">切换导航</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button> 
      -->
      <!-- 品牌名称或logo -->
      <a class="navbar-brand" href="https://weather.cma.cn/" target="_blank">
		  <span style="font-size: xx-large;" id="nav-weather">&emsp;&emsp;</span>
		  <small id="nav-weather-t">&emsp;&emsp;</small>
	   </a> 
    </div>
    <!-- 导航项目 -->
    <div class="collapse navbar-collapse navbar-collapse-example nav-tabs">
      <!-- 一般导航项目 -->
      <ul class="nav navbar-nav">
          <li id="home"><a href="/home"><span style="font-size: medium;"> 🎥 </span> 聚合首页</a></li>
		  <li id="live"><a href="/live"><span style="font-size: medium;"> 📺︎ </span> 电视直播</a></li>
		  <li id="acg" ><a href="/acg" ><span style="font-size: medium;"> 🥷 </span> 动漫番剧</a></li>
      </ul>
      
      <!-- 右侧的导航项目 -->
      <ul class="nav navbar-nav navbar-right">
        <li><a id="his" href="/his" target="_blank"> 🕒 看过</a></li>
        <li><a href="https://news.topurl.cn/" target="_blank"> 📰 新闻</a></li>
        <!--
        <li class="dropdown">
          <a href="your/nice/url" class="dropdown-toggle" data-toggle="dropdown">探索 <b class="caret"></b></a>
          <ul class="dropdown-menu" role="menu">
            <li><a href="your/nice/url">敏捷开发</a></li>
            <li><a href="your/nice/url">HTML5</a></li>
            <li><a href="your/nice/url">Javascript</a></li>
            <li class="divider"></li>
            <li><a href="your/nice/url">探索宇宙</a></li>
          </ul>
        </li>
        -->
      </ul>
      
    </div><!-- END .navbar-collapse -->
  </div>
</nav>

</div>

<!-- ZUI Javascript 依赖 jQuery -->
<script type="text/javascript" src="/js/jquery.js"></script>
<script type="text/javascript">

// 网页初始化
$(function(){
	weather();
});

/* 当前页菜单高亮显示 */
function highlightMenu(id){
	$('#'+id).addClass('active-menu');
}

/** 请求天气信息 */
function weather(){
	
	$.ajax({
		type: "GET",
        url: "https://news.topurl.cn/api",
        dataType: "json",
        success: function(data){
			 if(200 != data.code){
				 console.log('请求天气信息错误');
				 $('#nav-weather').html(weatherFormat(''))
				 return;
			 }
			 var weatherText = data.data.weather.detail.text_day;
			 $('#nav-weather').html(weatherFormat(weatherText));
			 var high = data.data.weather.detail.high;
			 var low = data.data.weather.detail.low;
			 $('#nav-weather-t').html(low + '~' + high + '℃');
        },
        error: function(err){
			new $.zui.Messager('系统发生错误，请稍后再试！', {
		        icon: 'danger' // 定义消息图标
		    }).show();   
		},
		complete: function(){
			
		}
	});
	
}


function weatherFormat(text){
	
	if(text.indexOf('阴') > -1){
		return '⛅';
	}
	if(text.indexOf('雷') > -1){
		return '⛈️';
	}
	if(text.indexOf('云') > -1){
		return '🌥️';
	}
	if(text.indexOf('雨') > -1){
		return '🌧️';
	}
	if(text.indexOf('雪') > -1){
		return '🌨️';
	}

	// 晴
	return '☀️';
}



</script>